<?php
/**
 * @package PWE.controler
 * @author Gmax <gmaxfr78@gmail.com>
 */
require_once(dirname(__FILE__).'/tools/tcpdf/tcpdf.php');

class pdfcreator extends controler{
    //put your code here
    public static function getPdf($type='pass',$user=null,$produit=null){
        $fileName = 'print_file';
        $pdf = new TCPDF('P', 'mm',array(210,297));
        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(false);
        $pdf->SetMargins(0, 0, -1,false);
        $pdf->SetAutoPageBreak(false);
        $pdf->AddPage();

        $html = '<h1>contenu</h1>';
        $pdf->writeHTML($html, false, false, false, false, 'c');

        $fileName = 'pdf';
        self::_setHeaders($pdf,$type,$user,$produit);
        
        $pdf->Output($fileName.'.pdf', 'I');
    }
    
    private static function _setHeaders($pdf){
        $pdf->SetAuthor(PWE::getSiteName());
        switch($type){
            default :
                $pdf->SetTitle('PDF');
                $pdf->SetSubject('PDF');
                break;
        }
    }
}
?>
